home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / msdos / 4utils80.zip / DMOUSE.PAS < prev    next >
Pascal/Delphi Source File  |  1993-12-17  |  3KB  |  91 lines

  1. UNIT dmouse;
  2. {$F+}  (* FAR calls are required for the mouse. *)
  3.  
  4. (* ----------------------------------------------------------------------
  5.    Part of 4DESC - A Simple 4DOS File Description Editor
  6.  
  7.    (c) Copyright 1993 by
  8.  
  9.        David Frey,         & Tom Bowden
  10.        Urdorferstrasse 30    1575 Canberra Drive
  11.        8952 Schlieren ZH     Stone Mountain, GA 30088-3629
  12.        Switzerland           USA
  13.  
  14.        Code created using Turbo Pascal 6.0 (c) Borland International 1990
  15.  
  16.    DISCLAIMER: This unit is freeware: you are allowed to use, copy
  17.                and change it free of charge, but you may not sell or hire
  18.                this part of 4DESC. The copyright remains in our hands.
  19.  
  20.                If you make any (considerable) changes to the source code,
  21.                please let us know. (send a copy or a listing).
  22.                We would like to see what you have done.
  23.  
  24.                We, David Frey and Tom Bowden, the authors, provide absolutely
  25.                no warranty of any kind. The user of this software takes the
  26.                entire risk of damages, failures, data losses or other
  27.                incidents.
  28.  
  29.    This unit handles the (very rudimentary) mouse functions of 4DESC.
  30.  
  31.    ----------------------------------------------------------------------- *)
  32.  
  33.  
  34. INTERFACE USES Dos;
  35.  
  36. CONST  Left  = 0;  (* Mouse buttons *)
  37.        Right = 1;
  38.  
  39. VAR    Regs         : Registers;
  40.        MouseLoaded  : Boolean;     (* TRUE if mouse driver is active *)
  41.        ReleaseCount : Integer;     (* Number of button releases *)
  42.        VMickey      : Integer;     (* Vertical mouse movement in mickeys *)
  43.        HMickey      : Integer;     (* Horizontal mouse movement in mickeys *)
  44.        VMickeysPerKeyPress: INTEGER; (* After a move of
  45.                                         VMickeysPerKeyPress mickeys an
  46.                                         up/down keypress will be emulated *)
  47.        HMickeysPerKeyPress: INTEGER; (* After a move of
  48.                                         VMickeysPerKeyPress mickeys an
  49.                                         up/down keypress will be emulated *)
  50.  
  51. PROCEDURE MouseReset;
  52. PROCEDURE ButtonReleased (Button : INTEGER);
  53. PROCEDURE MouseMotion;
  54.  
  55. IMPLEMENTATION USES HandleINIFile;
  56.  
  57. PROCEDURE MouseReset;
  58. BEGIN
  59.   Regs.ax := 0;
  60.   Intr ($33, Regs);        (* The mouse driver uses interrupt $33 *)
  61.   IF Regs.ax <> 0 THEN
  62.       MouseLoaded := TRUE
  63.   ELSE
  64.       MouseLoaded := FALSE;
  65. END; (* MouseReset *)
  66.  
  67.  
  68. PROCEDURE ButtonReleased;
  69. BEGIN
  70.   Regs.ax := 6;
  71.   Regs.bx := Button;
  72.   Intr ($33, Regs);
  73.   ReleaseCount := Regs.bx;
  74. END; (* ButtonReleased *)
  75.  
  76.  
  77. PROCEDURE MouseMotion;
  78. BEGIN
  79.   Regs.ax := 11;
  80.   Intr ($33, Regs);
  81.   VMickey := Regs.dx;
  82.   HMickey := Regs.cx;
  83. END; (* MouseMotion *)
  84.  
  85.  
  86. BEGIN
  87.   MouseReset;
  88.   VMickeysPerKeyPress := ReadSettingsInt('mouse','VMickeysPerKeypress',2);
  89.   HMickeysPerKeyPress := ReadSettingsInt('mouse','HMickeysPerKeypress',2);
  90. END.
  91.